Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Incorporating Controls From the Standard Parameters Dialog Box

Once you have defined the resource for your dialog box, you are ready to add code to your application to create the dialog box and add the effects controls to it. First, call GetNewDialog in the usual way to create an instance of the dialog box. Then call ImageCodecCreateStandardParameterDialog to incorporate the controls from the standard parameter dialog box into the dialog box. You then show the dialog box in the usual way.

The code in Listing 6 shows these steps.

Listing 6 Creating the dialog box and adding effect controls

movableModalDialog = GetNewDialog(kExtraDialogID, nil, (WindowPtr) -1);
if (movableModalDialog!=nil)
{
    // Add the user interface elements from the standard parameters
    // dialog box to the modal dialog box just created
    ImageCodecCreateStandardParameterDialog(gCompInstance,
                                                 parameterDescription,
                                                 gEffectSample,
                                                 pdOptionsModelDialogBox,
                                                 movableModalDialog,
                                                 kExtraUserItemID,
                                                 &createdDialogID);

    // Now show the dialog box and make it the default port
    ShowWindow(movableModalDialog);
    SelectWindow(movableModalDialog);
    SetPort(movableModalDialog);
}

The call to ImageCodecCreateStandardParameterDialog shows how to pass the existing dialog box ( movableModalDialog ) and the item number of the user item ( kExtraUserItemID ) that will be replaced with the controls from the standard parameter dialog box.

Once the effect controls have been added, the dialog box is shown, selected, and made the default port.

The rest of the code needed to handle the dialog box is largely the same as dealing with a stand-alone parameters dialog box. You pass every non-null event returned from WaitNextEvent through ImageCodecIsStandardParameterDialogEvent , and continue processing events yourself only if it returns featureUnsupported .

You track MouseDown events sent to the dialog box as usual. When the user clicks the OK button in the dialog box, you need to retrieve the values from the incorporated standard parameters dialog box. To do this, call the function ImageCodecStandardParameterDialogDoAction with the pdActionConfirmDialog action selector. This retrieves an effect description that describes the parameter values the user has chosen. You then call ImageCodecDismissStandardParameterDialog to dispose of the incorporated elements. After this is done, you call DisposeDialog to correctly dispose of the application's dialog box.


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |